use serde_json::json;
use tauri::Emitter;

pub fn data_task(topic: String, content: String, app_handle: tauri::AppHandle) {
    println!("Server: Received Data message with topic: {}", topic);
    println!("Server: Executing Data Task with content: {}...", content);
    let message = json!({
        "topic": topic,
        "content": content
    });
    app_handle
        .emit("data-task-message", message)
        .expect("Failed to emit to frontend")
}
